#define  _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;

class CComplex {
private:
	double real;
	double image;
public:
	CComplex() {

	}
	CComplex(double r, double i) {
		real = r;
		image = i;
	}
	void display() {
		if (image < 0) {
			cout << real << image << "i" << endl;
		}
		else {
			cout << real << "+" << image << "i" << endl;
		}
	}
	friend CComplex add(CComplex& a, CComplex& b);
	friend CComplex sub(CComplex& a, CComplex& b);
};

CComplex add(CComplex& a, CComplex& b) {
	CComplex c;
	c.image = a.image + b.image;
	c.real = a.real + b.real;
	return c;
}
CComplex sub(CComplex& a, CComplex& b) {
	CComplex c;
	c.image = a.image - b.image;
	c.real = a.real - b.real;
	return c;
}
int main()
{
	double r1, r2, i1, i2;
	cin >> r1 >> i1;
	cin >> r2 >> i2;
	CComplex c1(r1, i1), c2(r2, i2), c3, c4;
	c1.display();
	c2.display();
	c3 = add(c1, c2);
	c3.display();
	c4 = sub(c1, c2);
	c4.display();
}
